<template>
	<view class="ql-editor">
		<scroll-view class="scroll-view_H" scroll-y="true">
			<view class="m-t-10 m-l-20 m-r-20">
				<view class="m-t-15">
					<rich-text :nodes="titleContent"></rich-text>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		getAdviceDetail
	} from "@/api/home/home.js";
	import {
		getDictType
	} from "@/api/system/public.js";
	export default {
		data() {
			return {
				id: '',
				titleContent: '',
			}
		},
		onLoad: function(res) {
			this.id = res.id
			uni.setNavigationBarTitle({
				title: res.titleName || '详情'
			});
			this.getData()
		},
		methods: {
			/* 获取详情 */
			getData() {
				getAdviceDetail(this.id).then(res => {
					console.log(res)
					this.titleContent = this.unHtmlEncode(res.data.titleContent) || ''
				});
			},
			unHtmlEncode(handleString) {
				return handleString
					.replace(/&amp;/g, "&")
					.replace(/&lt;/g, "<")
					.replace(/&gt;/g, ">")
					.replace(/&nbsp;/g, " ")
					.replace(/&#39;/g, "\'")
					.replace(/&quot;/g, "\"");
			},
		}
	}
</script>

<style scoped lang="scss">
	page {
		height: 100%;


		.ql-editor {
			width: 100%;
			height: 100%;
			position: relative;
			background-color: #F6F7F9;

			.scroll-view_H {
				width: 100%;
				height: 100%;
			}

		}

	}
</style>
